package com.bjfu.demo.controller;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;

import com.bjfu.demo.entity.RpData;
import com.bjfu.demo.entity.RpResult;
import com.bjfu.demo.service.RpDataService;

/**
 * @create 2019-12-27 16:19
 */
//@RestController
//@RequestMapping("/rpdata")
public class RpDataController {

    @Autowired
    private RpDataService rpDataService;

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @GetMapping("/lists")
    public List<RpData> selectAllRpDatas() {




        List<RpData> rpDataList = rpDataService.selectAllRpDatas();

        if (rpDataList == null || rpDataList.size() == 0) {
            rpDataList = new ArrayList<>();
        }

        RpResult result = RpResult.ok().addData("rpDataList",rpDataList);

        //return result;

        return rpDataList;


    }
}
